package com.literaryfamily.literaryfamily.service.withdrawal;

import com.literaryfamily.literaryfamily.entity.Audit;
import com.literaryfamily.literaryfamily.entity.OperatorIncomes;
import com.literaryfamily.literaryfamily.entity.Payments;
import com.literaryfamily.literaryfamily.entity.Withdraws;
import com.literaryfamily.literaryfamily.myUtil.PageUtil;

import java.util.List;

/**
 * 用户提现接口
 * 所有涉及读写的方法都需要抛出 WriteError 数据库读写错误异常(这个是运行时异常,只需要抛出不需要处理)
 * 此接口所有方法均不检查用户身份,应该验证身份后在进行检查
 * @author 滑稽/因果报应
 */
public interface UserWithdrawalService {
	/**
	 * 申请提现
	 * @param operatorIncomes 申请信息
	 * @return 审核结果
	 */
	Audit applyForWithdrawal(OperatorIncomes operatorIncomes);

	/**
	 * 查询提现状态
	 * @param operatorId 运营商ID
	 * @return 提现记录
	 */
	Payments getWithdrawalRecords(Long operatorId);

	/**
	 * 推广收益（基于注册完成后计算）
	 * @param operatorIncomes 收益账单信息
	 * @return 收益结果
	 */
	OperatorIncomes revenueFromPromotion(OperatorIncomes operatorIncomes);

	/**
	 * 查询所有收益明细
	 * @param operatorId 运营商ID
	 * @param pageMsg 分页信息，空则不分页
	 * @return 支付记录列表
	 */
	List<Payments> getOperatorIncomeRecords(Long operatorId, PageUtil pageMsg);

	/**
	 * 进行提现,为运营商时额外记录运营商提现记录,并扩大额度(额度设定在常量包里)
	 * USERS_MAX_WITHDRAW_AMOUNT :普通用户一次最大提现额度
	 * OPERATORS_MAX_WITHDRAW_AMOUNT :运营商用户一次最大提现额度
	 * @param withdraws 提现记录
	 * @return 操作结果
	 */
	Withdraws withdraw(Withdraws withdraws);
}